package com.shanzhi.dify.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RetrievalModelRequestEntity {

    private String query;
    private RetrievalModel retrieval_model;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class RetrievalModel {
        private String search_method;
        private boolean reranking_enable;
        private String reranking_mode;
        private RerankingModel reranking_model;
        private Weights weights;
        private int top_k;
        private boolean score_threshold_enabled;
        private double score_threshold;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class RerankingModel {
        private String reranking_provider_name;
        private String reranking_model_name;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Weights {
        private String weight_type;
        private KeywordSetting keyword_setting;
        private VectorSetting vector_setting;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class KeywordSetting {
        private double keyword_weight;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class VectorSetting {
        private double vector_weight;
        private String embedding_model_name;
        private String embedding_provider_name;
    }
}